﻿<%@ Page Language="C#" MasterPageFile="~/Scores/MasterPage.master" AutoEventWireup="true" CodeFile="verify.aspx.cs" Inherits="Scores_verify" Title="无标题页" %>

<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
 <script type="text/javascript">
        var template = '<span style="color:{0};">{1}</span>';

        var Shenhe = function (value) {
            if(value==0){return String.format(template,'blue', '未审核');}
            if(value==1){return String.format(template,'red', '有效');}
            if(value==2){return String.format(template,'green', '无效');}
        }
    </script>
    <ext:Store ID="Store1" OnRefreshData="Store1_OnRefreshData" runat="server">
    <Reader>
        <ext:JsonReader ReaderID="guid">
            <Fields>
                <ext:RecordField Name="companyid" Type="String"></ext:RecordField>
                <ext:RecordField Name="companyname" Type="String"></ext:RecordField>
                <ext:RecordField Name="electricname" Type="String"></ext:RecordField>
                <ext:RecordField Name="tradename" Type="String"></ext:RecordField>
                <ext:RecordField Name="credit" Type="String"></ext:RecordField>
                <ext:RecordField Name="scores_now" Type="String"></ext:RecordField>
                <ext:RecordField Name="status" Type="Int"></ext:RecordField>
                <ext:RecordField Name="username" Type="String"></ext:RecordField>
                <ext:RecordField Name="deptname" Type="String"></ext:RecordField>
                <ext:RecordField Name="scores_pre" Type="Int"></ext:RecordField>
                <ext:RecordField Name="guid" Type="String"></ext:RecordField>
            </Fields>
        </ext:JsonReader>
    </Reader>
     <AutoLoadParams>
         <ext:Parameter Name="start" Mode="Raw" Value="0" />
         <ext:Parameter Name="limit" Mode="raw" Value="20" />
     </AutoLoadParams>
    </ext:Store>
    <ext:Store ID="StoreDetail" OnRefreshData="StoreDetail_onRefresh" runat="server">
        <Reader>
            <ext:JsonReader ReaderID="id">
                <Fields>
                    <ext:RecordField Name="id" Type="Int"></ext:RecordField>
                    <ext:RecordField Name="classname" Type="String"></ext:RecordField>
                    <ext:RecordField Name="tagname" Type="String"></ext:RecordField>
                    <ext:RecordField Name="detail" Type="String"></ext:RecordField>
                    <ext:RecordField Name="scores" Type="Int"></ext:RecordField>
                    <ext:RecordField Name="shidu" Type="String"></ext:RecordField>
                    <ext:RecordField Name="typename" Type="String"></ext:RecordField>
                    <ext:RecordField Name="basescores" Type="Int"></ext:RecordField>
                    <ext:RecordField Name="companyid" Type="String"></ext:RecordField>
                </Fields>
            </ext:JsonReader>
        </Reader>
        <BaseParams>
            <ext:Parameter 
            Name="guid" 
            Value="#{GridPanel1}.getSelectionModel().hasSelection() ? #{GridPanel1}.getSelectionModel().getSelected().id : -1"
            Mode="Raw">                    
            </ext:Parameter>
        </BaseParams>
    </ext:Store>
    <ext:Viewport runat="server" ID="ViewPort1">
    <Body>
        <Items>
            <ext:RowLayout runat="server" Split="true">
            <Rows>
                    <ext:LayoutRow RowHeight="0.5">
                        <ext:GridPanel ID="GridPanel1" StoreID="Store1" Title="已提交的评分记录列表" runat="server">
                    <ColumnModel>
                        <Columns>
                            <ext:Column ColumnID="companyid"  Header="户号" DataIndex="companyid" ></ext:Column>
                            <ext:Column ColumnID="companyname" Header="户名" DataIndex="companyname"></ext:Column>
                            <ext:Column ColumnID="tradename" Header="行业类别" DataIndex="tradename"></ext:Column>
                            <ext:Column ColumnID="electricname" Header="用电类别" DataIndex="electricname"></ext:Column>
                            <ext:Column ColumnID="scores_now" Header="信用分数" DataIndex="scores_now"></ext:Column>
                            <ext:Column ColumnID="credit" Header="信用等级" DataIndex="credit"></ext:Column>
                            <ext:Column ColumnID="deptname" Header="提交人" DataIndex="username"></ext:Column>
                            <ext:Column ColumnID="username" Header="所属部门/班组" DataIndex="deptname"></ext:Column>
                            <ext:Column ColumnID="scores_pre" Header="提交分数" DataIndex="scores_pre"></ext:Column>
                            <ext:Column ColumnID="status" Header="是否有效" DataIndex="status">
                                <Renderer Fn="Shenhe" />
                            </ext:Column>
                            <ext:CommandColumn ColumnID="ok" Header="批准">
                                <Commands>
                                    <ext:GridCommand CommandName="allow" Icon="Accept" Text="通过"></ext:GridCommand>
                                    <ext:GridCommand CommandName="unallow" Icon="Disconnect" Text="无效">
                                    </ext:GridCommand>
                                </Commands>
                            </ext:CommandColumn>
                        </Columns>
                    </ColumnModel>
                    <SelectionModel>
                        <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true">
                            <Listeners>
                                <RowSelect Handler="#{StoreDetail}.reload()" Buffer="250" />                                
                            </Listeners>
                        </ext:RowSelectionModel>
                    </SelectionModel>
                    <AjaxEvents>
                                <Command OnEvent="Allow">
                                    <ExtraParams>
                                        <ext:Parameter Mode="Raw" Name="companyid" Value="record.data.companyid"></ext:Parameter>
                                        <ext:Parameter Mode="Raw" Name="guid" Value="record.data.guid"></ext:Parameter>
                                        <ext:Parameter Mode="Raw" Name="cmd" Value="command"></ext:Parameter>
                                    </ExtraParams>
                                </Command>
                            </AjaxEvents>
                    <BottomBar>
                        <ext:PagingToolBar 
                            ID="PagingToolBar1" 
                            runat="server" 
                            PageSize="20" 
                            StoreID="Store1" 
                            />
                    </BottomBar>
                    <LoadMask ShowMask="true" />
                    </ext:GridPanel>
                    </ext:LayoutRow> 
                    <ext:LayoutRow RowHeight="0.5">
                    <ext:GridPanel ID="GridPanel2" Title="客户评分记录详细" StoreID="StoreDetail" runat="server">
                        <ColumnModel>
                            <Columns>
                                <ext:Column ColumnID="classname" DataIndex="classname" Header="要素"></ext:Column>
                                <ext:Column ColumnID="tagname" DataIndex="tagname" Header="指标"></ext:Column>
                                <ext:Column ColumnID="detail" DataIndex="detail" Header="指标说明"></ext:Column>
                                <ext:Column ColumnID="typename" DataIndex="typename" Header="指标类型"></ext:Column>
                                <ext:Column ColumnID="shidu" DataIndex="shidu" Header="适度区间"></ext:Column>
                                <ext:Column ColumnID="basescores" DataIndex="basescores" Header="权重"></ext:Column>
                                <ext:Column ColumnID="scores" DataIndex="scores" Header="得分"></ext:Column>
                            </Columns>
                        </ColumnModel>
                         
                    </ext:GridPanel>
                    </ext:LayoutRow>
             </Rows>
            </ext:RowLayout>
        </Items>
        </Body>
    </ext:Viewport>
</asp:Content>

